package org.teremail.mailbox;

import java.util.List;

/**
 * Proxy to a real folder object.
 * 
 * @author Michael Barker
 *
 */
public class FolderProxy implements Folder {

    private final MailboxServiceImpl service;
    private final FolderDO folder;

    public FolderProxy(MailboxServiceImpl service, FolderDO folder) {
        this.service = service;
        this.folder = folder;
    }

    /**
     * Gets the short name of this folder
     */
    public String getName() {
        return folder.getName();
    }
    
    /**
     * Gets the full path name of this folder
     */
    public Path getPath() {
        return folder.getPath();
    }

    public List<FolderEntry> getFolderEntries(int pageNo, int pageSize, SortKey...sortKeys) {
        return service.getFolderEntries(folder, pageNo, pageSize, sortKeys);
    }

    public FolderEntry getMessage(int uid) throws EntryNotExistsException {
        return service.getFolderEntry(folder, uid);
    }

}
